package repository.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import repository.WorkPostRepository;
import domain.User;
import domain.WorkPost;


@Repository
public class WorkPostRepositoryImpl extends AbstractHibernateRepository<WorkPost> implements WorkPostRepository {

	@Autowired
	public WorkPostRepositoryImpl(SessionFactory sessionfactory){
		super(sessionfactory);
	}

	@Override
	public WorkPost get(int id) {
		return get(WorkPost.class, id);
	}
	
	@Override
	public void save(WorkPost WorkPost) {
		super.save(WorkPost);
	}

	@Override
	public List<WorkPost> getWorkPostsByUser(User user) {
		String hql = "FROM WorkPost WHERE creator=?";
		return find(hql, user);
	}
	
	@Override
	public void delete(WorkPost e) {
		super.delete(e);
	}

}